package think.thread.sychron.c01;

import java.util.concurrent.TimeUnit;

public class WaxOff implements Runnable {
	private Car car;

	public WaxOff(Car car) {
		this.car = car;
	}

	public void run() {

		try {
			while (!Thread.interrupted()) {
				// 先打蜡才能抛光
				car.waitForWaxing();
				System.out.println("wax off");
				TimeUnit.MILLISECONDS.sleep(200);
				car.buffed();
			}
		} catch (Exception e) {
			System.out.println("wax off exit via interrupted");
		}

		System.out.println("exit");
	}

}